package com.hexb.smh.entity.view;

import com.hexb.smh.utils.Converters;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.util.StringUtils;

import java.math.BigDecimal;

/**
 * @author : hexb
 * 指定了品牌的项目,价格为指定品牌的价格
 */
@Data
@NoArgsConstructor
public class ProductBrandView {
    private Integer id;

    @ApiModelProperty("简码")
    private String briefCode;

    @ApiModelProperty("描述(业务员可见)")
    private String description;

    @ApiModelProperty("项目名称")
    private String name;

    @ApiModelProperty("项目编码,全系统唯一")
    private String itemNo;

    @ApiModelProperty("固定成本价")
    private String fixedCostPrice;

    @ApiModelProperty("可变成本价")
    private String volatileCostPrice;

    @ApiModelProperty("其它成本价")
    private String otherCostPrice;

    @ApiModelProperty("市场价")
    private String marketPrice;

    @ApiModelProperty("品牌名称")
    private String brandName;

    @ApiModelProperty("是否可以被选择")
    public Boolean getCheckSupport() {
        return !StringUtils.isEmpty(marketPrice);
    }

    public void setCheckSupport(boolean b) {
        //仅为json反序列化时提供setter
    }

    public void setFixedCostPrice(BigDecimal fixedCostPrice) {
        this.fixedCostPrice = Converters.decimalAmountFormat(fixedCostPrice);
    }

    public void setVolatileCostPrice(BigDecimal volatileCostPrice) {
        this.volatileCostPrice = Converters.decimalAmountFormat(volatileCostPrice);
    }

    public void setOtherCostPrice(BigDecimal otherCostPrice) {
        this.otherCostPrice = Converters.decimalAmountFormat(otherCostPrice);
    }

    public void setMarketPrice(BigDecimal marketPrice) {
        this.marketPrice = Converters.decimalAmountFormat(marketPrice);
    }

}
